//
//  TextEditorDemo.swift
//  SwiftUIDemo
//
//  Created by Tilt Wang on 2025/7/1.
//

import SwiftUI

struct TextEditorDemo: View {
    
    @State var textEditorText: String = "This is the starting text."
    @State var saveText: String = ""
    
    var body: some View {
        NavigationView {
            VStack {
                TextEditor(text: $textEditorText)
                    .frame(height: 250)
//                    .foregroundColor(.red)
//                    .background(.blue)
                    .colorMultiply(Color.yellow)
                    .cornerRadius(10)
                Button {
                    saveText = textEditorText
                } label: {
                    Text("Save")
                        .font(.headline)
                        .foregroundColor(.white)
                        
                        .padding()
                        .frame(maxWidth: .infinity)
                        .background(.blue)
                        .cornerRadius(10)
                }
                Text(saveText)
                Spacer()
            }
            .padding()
            .background(.green)
            .navigationTitle("TextEditor Demo")
        }
    }
}

#Preview {
    TextEditorDemo()
}
